3e9d1a
@@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.regionserver;
 
 import com.google.common.annotations.VisibleForTesting;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.net.BindException;
@@ -81,6 +82,7 @@
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
 import org.apache.hadoop.hbase.exceptions.ScannerResetException;
 import org.apache.hadoop.hbase.filter.ByteArrayComparable;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
 import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
 import org.apache.hadoop.hbase.ipc.HBaseRpcController;
 import org.apache.hadoop.hbase.ipc.PriorityFunction;
@@ -2997,6 +2999,11 @@
public class RSRpcServices implements HBaseRPCErrorHandler,
           // scanner is closed here
           scannerClosed = true;
 
+          // If it is a CorruptHFileException or a FileNotFoundException, throw the
+          // DoNotRetryIOException. This can avoid the retry in ClientScanner.
+          if (e instanceof CorruptHFileException || e instanceof FileNotFoundException) {
+            throw new DoNotRetryIOException(e);
+          }
           // We closed the scanner already. Instead of throwing the IOException, and client
           // retrying with the same scannerId only to get USE on the next RPC, we directly throw
           // a special exception to save an RPC.
